package edu.gdkm.dao;

import edu.gdkm.pojo.Position;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface PositionDAO {
    @Select("select * from position where id = #{id}")
    Position findById(Integer id);
    @Select("select * from position where name = #{name}")
    Position findByName(String name);
    @Select("select * from position")
    List<Position> findAll();
    @Insert("insert into position(name, level, description, created_time) values(#{name}, #{level}, #{description}, #{created_time})")
    boolean save(Position position);
    @Update( "update position set name = #{name}, level = #{level}, description = #{description}, updated_time = #{updated_time} where id = #{id}")
    boolean update(Position position);
    @Delete("delete from position where id = #{id}")
    boolean delete(Integer id);
}
